<template>
  <div class="container">
    <div class="coin">提现手续费 ：
      <el-input v-model="val" style="width:200px;"></el-input>
      <el-button type="primary" @click.native="clickOk()">修改</el-button>
    </div>

    <h1 class="about">关于我们</h1>

    <el-table :data="aboutList" border style="width: 100%">
      <el-table-column label="电话">
        <template slot-scope="scope">
          <el-input v-model.number="scope.row.phone" placeholder="请输入电话"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="姓名">
        <template slot-scope="scope">
          <el-input v-model.number="scope.row.email" placeholder="请输入姓名"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="平台简介">
        <template slot-scope="scope">
          <el-input v-model.number="scope.row.intro" type="textarea" :rows="7"  placeholder="请输入平台简介"></el-input>
        </template>
      </el-table-column>
    </el-table>

    <div class="editBtn">
      <el-button type="primary" @click="editAbout()">修改</el-button>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      val: "",
      aboutList: []
    };
  },
  created() {
    this.getList();
    this.getAbout();
  },
  methods: {
    //修改
    editAbout(row){
     let url = "/config/putAboutWe";
      let params = {
        phone:this.aboutList[0].phone,
        intro:this.aboutList[0].intro,
        email:this.aboutList[0].email,
      };
      console.log(params);
      this.httpPost(url, params, res => {
        if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success"
          });
        }else{
           this.$message({
            message: res.message,
            type: "warning"
          });
        }
      });
    },
    //获取提现手续费
    getList() {
      let url = "/config/get/CASHMONEY";
      this.httpPost(url, {}, res => {
        if (res.code == 200) {
          this.val = res.data.val;
        }
      });
    },
    //获取关于我们
    getAbout() {
      let url = "/config/getAboutWe";
      this.httpPost(url, {}, res => {
        if (res.code == 200) {
          let info = res.data;
          this.aboutList.push(info);
          console.log(this.aboutList);
        }
      });
    },
    //修改提现手续费
    clickOk() {
      let url = "/config/put";
      let params = {
        key: "CASHMONEY",
        val: this.val
      };
      this.httpPost(url, params, res => {
        if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success"
          });
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  padding: 20px;
}
.about {
  margin: 20px 0;
}
.editBtn{
   margin: 20px 0;
   float: right;
}
</style>